import requests
import json
if __name__ =='__main__':
    url = 'https://movie.douban.com/j/chart/top_list'
    param = {
        'type': '3',
        'interval_id': '100:90',
        'action': '',
        'start': '0',#从库中的第几部电影去取
        'limit': '100',#一次取出的个数
    }

    headers = {
        'user-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36'
    }

    response = requests.get(url=url,params=param,headers=headers)

    list_data = response.json()

    fp = open('douban.json', 'w', encoding='utf-8')
    json.dump(list_data,fp=fp,ensure_ascii=False)

    print('over!!!')